package logic

import (
	"context"
	"goods_svc/models/mysql"

	"goods_svc/goods"
	"goods_svc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ActivityShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewActivityShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ActivityShowLogic {
	return &ActivityShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 活动详情
func (l *ActivityShowLogic) ActivityShow(in *goods.ActivityShowRequest) (*goods.ActivityShowResponse, error) {
	// todo: add your logic here and delete this line

	//去mysql数据库查询一下
	var activity mysql.Activity
	mysql.DB.Debug().Where("id = ?", in.Id).Find(&activity)

	//实现活动详情
	return &goods.ActivityShowResponse{
		ActivityName: activity.ActivityName,
		Address:      activity.Address,
		Time:         activity.Time,
		Name:         activity.Name,
	}, nil
}
